package com.houger.ddd.seckill.constant;

import java.util.Arrays;

public enum InstanceCloseTypeEnum {

    NOT_CLOSE(0,"不关闭"),
    AUTO_CLOSE_AFTER(1,"发起后相对时间关闭")
    ;

    private int value;
    private String desc;

    InstanceCloseTypeEnum(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public int getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    public static InstanceCloseTypeEnum getEnumByCode(int value) {
        return Arrays.stream(InstanceCloseTypeEnum.values()).filter(a -> a.value == value).findFirst().orElse(NOT_CLOSE);
    }

}
